package com.wsc.juc_001.c_007;

/**
 * 同步和非同步方法是否可以同时调用,可以
 */
public class Synchronized_07 {
    public synchronized void m1(){
        System.out.println(Thread.currentThread().getName() + "m1 is start");
        try {
            Thread.sleep(10000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println(Thread.currentThread().getName() + "m1 is end");
    }
    public void m2(){
        System.out.println(Thread.currentThread().getName()+ "m2 is run");
    }

    public static void main(String[] args) {
        Synchronized_07 synchronized_07 = new Synchronized_07();
        new Thread(synchronized_07::m1).start();
        new Thread(synchronized_07::m2).start();
    }
}
